 function init(){
	 bdLockCard.HotelPwd = '11111111';
	 bdLockCard.Hotel =  'BTLOCK56';
	 bdLockCard.FPortNo = '1'; //com1  1  com2 2  com3  3  com4 4
	 bdLockCard.FReaderType = '2' ;  //BTEM232 1  BTIB232 2   
	 bdLockCard.FCardType =  '1'; //EM4150 0    EM4469 1
	 bdLockCard.FSector = '5' ; //EM4150 0  FSector 3   , EM4469 1  FSector 5
	 bdLockCard.FBlock = '0' ; 
	
}
function readCardSNR(){
	init();
	bdLockCard.readSnr();
	alert(bdLockCard.FTime);
	var snr= bdLockCard.SNR;
	return snr;
}
function readCardLockNumber()
{
	init();
	bdLockCard.readCard();
	var n=bdLockCard.LockNo;
	return n;
}
function writeMemberCard(time,lockNumber)
{
	init();
	bdLockCard.LockNo=lockNumber;
	bdLockCard.FTime=time;
	bdLockCard.writeCard();
	alert("入住成功！");

}
function writeNomalCard(time,lockNumber,snr,aMessage){
	init();
	var cursnr =readCardSNR();
	if(snr!=cursnr){
		alert("读卡与写卡不一致！请重新写卡");
		return ;
	}
	bdLockCard.LockNo=lockNumber;
	bdLockCard.FTime=time;
	bdLockCard.writeCard();
	alert(aMessage);
}
function writeNomalCardInvalid(time,snr)
{
	init();
	var curSnr=readCardSNR();
	if(snr!=curSnr)
	{
		if(confirm("系统检测卡与当前卡不一致，是否要继续!")){
			
		}else{
			alert("退房成功！但未写卡");
		  return ;
		}
	}
	bdLockCard.LockNo='0';
	bdLockCard.FTime=time;
	bdLockCard.writeCard();
	alert("退房成功！");
}
function writeCard(cardNo)
{
	init();
	bdLockCard.CardID=cardNo;
	bdLockCard.writeCard();
}
function writeMemberCardInvalid(time,snr)
{
	init();
	var curSnr=readCardSNR();
	if(snr!=curSnr)
	{
		alert("请用正确的卡");
		if(confirm("系统检测卡与当前卡不一致，是否要继续!")){
			
		}else{
		  return ;
		}
	}
	bdLockCard.LockNo='0';
	bdLockCard.FTime=time;
	bdLockCard.writeCard();
	alert("");
}
function write()
{
  alert("23");
}